/*
 * AgentsActivity.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.agents;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.utils.ActivityUtils;

/** 我的 我是代理商 */
public class AgentsActivity extends BaseActivity {

    private AgentsFragment mFragment;

    public static void actionStart(Activity activity, boolean toAgentOrderFragment) {
        Intent intent = new Intent(activity, AgentsActivity.class);
        intent.putExtra(Intents.EXTRA_TO_AGENT_ORDER_FRAGMENT, toAgentOrderFragment);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mFragment =
                (AgentsFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_agents);
        if (mFragment == null) {
            mFragment = AgentsFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), mFragment, R.id.container_agents);
        }
    }

    @Override
    protected void initPresenter() {
        new AgentsPresenter(mFragment);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_agents;
    }
}
